home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 4527 < prev    next >
Encoding:
Text File  |  1996-08-06  |  951 b   |  40 lines

  1. Path: news.cerf.net!news
  2. From: Michael McKibben <mckibben@cerf.net>
  3. Newsgroups: comp.lang.c++
  4. Subject: Basic STL istream_iterator Q.
  5. Date: Tue, 30 Jan 1996 12:15:01 -0800
  6. Organization: CERFnet
  7. Message-ID: <310E7C45.12F2@cerf.net>
  8. NNTP-Posting-Host: pike.cerf.net
  9. Mime-Version: 1.0
  10. Content-Type: text/plain; charset=us-ascii
  11. Content-Transfer-Encoding: 7bit
  12. X-Mailer: Mozilla 2.0b5 (X11; I; SunOS 5.5 sun4m)
  13.  
  14. I'm having a problem using istream_iterator<T> with gcc-2.7.2 and
  15. gcc's libstd++.
  16.  
  17. The following code works, but skips over all white space in the input
  18. file. What am I doing wrong?
  19.  
  20. /* simple file copy */
  21. #include <iostream.h>
  22. #include <fstream.h>
  23. #include <stl.h>
  24.  
  25. int main (int,char**) {
  26.   ifstream if("foo.in");
  27.   ofstream of("foo.out");
  28.  
  29.   copy(istream_iterator<char>(if),
  30.        istream_iterator<char>(),
  31.        ostream_iterator<char>(of));
  32.  
  33.   return 0;
  34. }
  35.  
  36.  
  37. -mike
  38. ------------------------------------
  39. Michael McKibben <mckibben@cerf.net>
  40.